import { http } from '@/tool/utils'
import { iPb } from '@/protobuf/interface'

export function ListArticle(data: iPb.Admin.IListArticleRequest):Promise<iPb.Admin.IListArticleResponse> {
    return http.post("ListArticle",iPb.Admin.ListArticleRequest.toObject(iPb.Admin.ListArticleRequest.create(data)))
}

export function CreateArticle(data: iPb.IDbArticle):Promise<iPb.Admin.ICreateArticleResponse> {
    return http.post("CreateArticle",iPb.DbArticle.toObject(iPb.DbArticle.create(data)))
}

export function UpdateArticle(data: iPb.IDbArticle):Promise<iPb.Admin.IUpdateArticleResponse> {
    return http.post("UpdateArticle",iPb.DbArticle.toObject(iPb.DbArticle.create(data)))
}

export function ReadArticle(formData: iPb.Admin.IReadArticleRequest):Promise<iPb.IDbArticle> {
    return http.post("ReadArticle",iPb.Admin.ReadArticleRequest.create(formData))
}

export function DeleteArticle(formData: iPb.Admin.IDeleteArticleRequest):Promise<iPb.Admin.IDeleteArticleResponse> {
    return http.post("DeleteArticle",iPb.Admin.DeleteArticleRequest.create(formData))
}